/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.querie.collab;

import java.sql.SQLException;

import com.querie.util.QryParameters;
import com.querie.pojo.QueryItemResult;

/**
 *
 * @author a-skoshy
 */
public class FrontEndProcessor {

    public FrontEndProcessor() {
    }

    public QueryItemResult processSimilarityAndQueryResults(Integer sessionId, String txtQuery) throws Exception{
        ItemSimilarity sim = null;
        QryParameters qParam = QryParameters.getInstance();
        String algoType = qParam.getValue("ALGO");
        if (algoType.equals("jac")) {
            sim = new JacItemSimilarity();
        } else if (algoType.equals("cos")) {
            sim = new CosineItemSimilarity();
        } else {
            throw new Exception("Unknown Algorithm");
        }
        QueryItemResult result = sim.findSimilarity(sessionId, txtQuery);
        System.out.println(result);
        sim.close();

        return result;

    }
}
